#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5;
int n,cnt[N + 5],t,m,a[N + 5],lazy,dd,lf;
signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> t;
        if (!cnt[t])
            a[++m] = t;
        cnt[t]++;
    }
    sort(a + 1,a + m + 1);
    for(int i = 1;i < m;i++)
        if (cnt[a[i]] <= cnt[a[i + 1]]){
            dd += cnt[a[i]];
            if (lazy){
                lf = cnt[a[i + 1]] - cnt[a[i]];
                if (lf >= lazy){
                    dd += lazy;
                    lazy = 0;
                }else{
                    dd += lf;
                    lazy -= lf;
                }
            }
        }else{
            dd += cnt[a[i + 1]];
            lazy += cnt[a[i]] - cnt[a[i + 1]];
        }
    cout << n - dd << endl;
    return 0;
}